//
//  YSChannelHeader.m
//  YSKitDemo
//
//  Created by MOLBASE on 2018/8/14.
//  Copyright © 2018年 YangShen. All rights reserved.
//

#import "YSChannelHeader.h"

@implementation YSChannelHeader {
    UILabel *_titleLabel;
    UILabel *_subtitleLabel;
}

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self buildUI];
    }
    return self;
}

- (void)buildUI {
    CGFloat marginX    = 15.0f;
    CGFloat labelWidth = (self.bounds.size.width - 2 * marginX) / 2.0f;

    _titleLabel           = [[UILabel alloc] initWithFrame:CGRectMake(marginX, 0, labelWidth, self.bounds.size.height)];
    _titleLabel.textColor = [UIColor blackColor];
    [self addSubview:_titleLabel];

    _subtitleLabel               = [[UILabel alloc] initWithFrame:CGRectMake(marginX + labelWidth, 0, labelWidth, self.bounds.size.height)];
    _subtitleLabel.textColor     = [UIColor lightGrayColor];
    _subtitleLabel.textAlignment = NSTextAlignmentRight;
    _subtitleLabel.font          = [UIFont systemFontOfSize:15.0f];
    [self addSubview:_subtitleLabel];
}

- (void)setTitle:(NSString *)title {
    _title           = title;
    _titleLabel.text = title;
}

- (void)setSubTitle:(NSString *)subTitle {
    _subTitle           = subTitle;
    _subtitleLabel.text = subTitle;
}


@end
